﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Entity.Core.Objects;
using System.Data.Entity.Spatial;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TreeManagement
{
    public partial class WardForm : Form
    {
        public WardForm()
        {
            InitializeComponent();
        }

        private void WardForm_Load(object sender, EventArgs e)
        {
            using (var context = new TreeDBEntities())
            {
                dgvView.DataSource = context.Wards.ToList();
                viewPanel1.Wards = context.Wards.Local.ToList();
                viewPanel1.Roads = context.Roads.ToList();
                viewPanel1.Refresh();
            }
        }
        public void reload()
        {
            using (var context = new TreeDBEntities())
            {
                dgvView.DataSource = context.Wards.ToList();
                viewPanel1.Wards = context.Wards.Local.ToList();
                viewPanel1.Roads = context.Roads.ToList();
                viewPanel1.Refresh();
            }
      
        }
        private void btnNew_Click(object sender, EventArgs e)
        {
            EditWardForm frm = new EditWardForm();
            frm.FormType = ActionType.NEW_WARD;
            frm.EditWardFormParent = (Form)this;
            frm.ShowDialog();
        }
        
    }
}
